package com.tokenmaster.aitrade;

import java.text.SimpleDateFormat;

import org.apache.log4j.Logger;

import com.tokenmaster.aitrade.market.okex.IOkex_Parameter.Types_Enum;
import com.tokenmaster.aitrade.trade.KLinesManager;

/**
 * Hello world!
 *
 */
public class RunKLine_okex {
	public static void main(String[] args) {
		KLinesManager kLinesManager = new KLinesManager();
		Logger logger = Logger.getLogger(RunKLine_okex.class);
		SimpleDateFormat sformat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");

		while (true) {
			try {
				// 每隔5秒取一次行情
				String timestr = sformat.format(System.currentTimeMillis());
				logger.info("Get new KLine: " + timestr);

				kLinesManager.checkNewKLine("btc_usdt", Types_Enum.HOUR4);
				Thread.sleep(5000);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
